package com.bwie.controller;

import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.hutool.poi.excel.ExcelFileUtil;
import com.bwie.pojo.Result;
import com.bwie.pojo.vo.StudentVo;
import com.bwie.service.StudentService;
import com.bwie.utils.poi.EasyPoiUtil;
import org.apache.commons.lang.math.IEEE754rUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @className: StudentController
 * @Description: TODO
 * @version: v1.８.0
 * @author: 张雨乐
 * @date: 2025/6/9 9:14
 */
@Controller
@RequestMapping("student")
public class StudentController {
    @Autowired
    StudentService studentService;
    @Autowired
    EasyPoiUtil easyPoiUtil;

    @RequestMapping("list")
    @ResponseBody
    public Result list(){
        return studentService.list();
    }
    @RequestMapping("chu")
    public void chu(@RequestParam String ids, HttpServletResponse res){
        List<StudentVo>list=studentService.getStudent(ids);
        System.out.println(list);
        easyPoiUtil.exportExcel(res,list,StudentVo.class,"导出");
    }
}
